package io.lvdaxian.mybatis19.reflection.invoker;

import java.lang.reflect.Field;

/**
 * 这里是 set 属性的时候执行器
 *
 * @author lihh
 */
public class SetFieldInvoker implements Invoker {
  
  private final Field field;
  
  public SetFieldInvoker(Field field) {
    this.field = field;
  }
  
  @Override
  public Object invoke(Object target, Object[] args) throws Exception {
    field.set(target, args[0]);
    return null;
  }
  
  @Override
  public Class<?> getType() {
    return field.getType();
  }
}
